//待办事项
var add = document.querySelector("#add");
add.addEventListener("click",function () {
    //获取 input 的内容
    var  ipt = document.querySelector("#ipt");
    console.log(ipt.value);
    //创建 li标签
    var li = document.createElement("li");
    //创建span标签
    var  span = document.createElement("span");
    var span_text = document.createTextNode(ipt.value);
    span.appendChild(span_text);
    //创建button标签
    var  button = document.createElement("button");
    var button_text = document.createTextNode("×");
    span.setAttribute("contenteditable","true");
    span.style.outline = "none";
    button.appendChild(button_text);
    button.addEventListener("click",function () {
        console.log(this.parentNode);
        var  list = document.querySelector("#list");
        list.removeChild(this.parentNode);
    })


    //把span和button 追加到li标签
    li.appendChild(span);
    li.appendChild(button);
    console.log(li);
    console.log(span);
    console.log(button);
    //把li标签追加到ul里面
    var list = document.querySelector("#list");
    list.appendChild(li);
})
